<?php
namespace Plu\Library\Services\Tga\Messageboard;

use Plu\Library\Services\ServiceBase;

class ValidationService extends ServiceBase {
    protected $_redis;

    protected $_appkey;

    public function __construct($appkey) {
        $this->_redis = new RedisService;
        $this->_appkey = $appkey;
    }

    public function messageCheck($uid){
        //根据$this->_formInfo获得
        $cooldowntime = 1; //1天
        $times = 1;//周期内投票次数 目前只能是1

        $now = date('Ymd');
        $time = $this->_redis->getMessage($this->_appkey, $now, $uid);
        if ($time && $time >= $times) {
            return false;
        } else {
            return true;
        }

    }

    public function admireCheck($field){
		//根据$this->_formInfo获得
        $cooldowntime = 1; //1天
        $times = 1;//周期内投票次数 目前只能是1

        $now = date('Ymd');
        $time = $this->_redis->getAdmire($this->_appkey, $now, $field);
        if ($time && $time >= $times) {
            return false;
        } else {
            return true;
        }

    }
}
?>
